#include <iostream>
#include <cstring>

using namespace std;
int main() {
    int n;
    int a; //加法
    int b; //减法
    int c; //乘法
    char last, s[20], ans[20];
    scanf("%d\n", &n);
    while (n--) {
        fgets(s, sizeof(s), stdin);
        if (s[0] == 'a' || s[0] == 'b' || s[0] == 'c')
            last = s[0], s[0] = ' ';
        sscanf(s, "%d %d", &a, &b);
        switch (last) {
            case 'a': //加法
                c = a + b;
                sprintf(ans, "%d+%d=%d", a, b, c);
                break;
            case 'b': //减法
                c = a - b;
                sprintf(ans, "%d-%d=%d", a, b, c);
                break;
            case 'c': //乘法
                c = a * b;
                sprintf(ans, "%d*%d=%d", a, b, c);
                break;
        }
        printf("%s\n%d\n", ans, strlen(ans));  //输出
    }
}